﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyMainSite2.Library.Extensions
{
	public static class UriExtensions
	{
		#region Public Static Methods

		public static bool IsCurrentUrl(this Uri uri, string url)
		{
			if (String.IsNullOrWhiteSpace(url))
				return false;

			url = url.Trim().ToLower();
			string absolutePath = uri.AbsolutePath.Trim().ToLower();

			if (!url.StartsWith("/") && absolutePath.StartsWith("/"))
				absolutePath = absolutePath.Remove(0, 1);

			bool match = absolutePath == url;

			return match;
		}

		#endregion
	}
}
